package com.liangliang.controller;

import com.liangliang.mapper.*;
import com.liangliang.pojo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * ClassName: Controller
 * Package: com.liangliang.controller
 * Description:
 *
 * @Author 姚亮亮
 * @Create 2024/7/23 15:03
 * @Version 1.0
 */
@org.springframework.stereotype.Controller
public class Controller {
    @Autowired
    private AdsAreaProductTop3Mapper adsAreaProductTop3Mapper;

    @Autowired
    private AdsCategoryTop10Mapper adsCategoryTop10Mapper;

    @Autowired
    private AdsClickSessionTop10Mapper adsClickSessionTop10Mapper;

    @Autowired
    private AdsProvinceCityAdClicksMapper adsProvinceCityAdClicksMapper;

    @Autowired
    private AdsProvinceTop3Mapper adsProvinceTop3Mapper;

    @Autowired
    private AdsSessionStepRatioMapper adsSessionStepRatioMapper;

    @Autowired
    private AdsSessionTimeRatioMapper adsSessionTimeRatioMapper;

    @GetMapping("/api/areaproducttop3")
    public String getChartPage(Model model) {
        return "api/areaproducttop3";
    }

    @GetMapping("/api/areaproducttop3/data")
    @ResponseBody
    public List<AdsAreaProductTop3> getData() {
        return adsAreaProductTop3Mapper.selectList(null);
    }

    @GetMapping("/api/categoriestop10")
    public String getCategoryChartPage(Model model) {
        return "api/categoriestop10";
    }

    @GetMapping("/api/categoriestop10/data")
    @ResponseBody
    public List<AdsCategoryTop10> getCategoryData() {
        return adsCategoryTop10Mapper.selectList(null);
    }

    @GetMapping("/api/clicksessiontop10")
    public String getClickSessionChartPage(Model model) {
        return "api/clicksessiontop10";
    }

    @GetMapping("/api/clicksessiontop10/data")
    @ResponseBody
    public List<AdsClickSessionTop10> getClickSessionData() {
        return adsClickSessionTop10Mapper.selectList(null);
    }

    @GetMapping("/api/province_city_ad_clicks")
    public String getProvinceCityAdClicksChartPage(Model model) {
        return "api/province_city_ad_clicks";
    }

    @GetMapping("/api/province_city_ad_clicks/data")
    @ResponseBody
    public List<AdsProvinceCityAdClicks> getProvinceCityAdClicksData() {
        return adsProvinceCityAdClicksMapper.selectList(null);
    }

    @GetMapping("/api/province_top3")
    public String getProvinceTop3ChartPage(Model model) {
        return "api/province_top3";
    }

    @GetMapping("/api/province_top3/data")
    @ResponseBody
    public List<AdsProvinceTop3> getProvinceTop3Data() {
        return adsProvinceTop3Mapper.selectList(null);
    }

    @GetMapping("/api/session_step_ratio")
    public String getSessionStepRatioChartPage(Model model) {
        return "api/session_step_ratio";
    }

    @GetMapping("/api/session_step_ratio/data")
    @ResponseBody
    public List<AdsSessionStepRatio> getSessionStepRatioData() {
        return adsSessionStepRatioMapper.selectAll();
    }


    @GetMapping("/api/session_time_ratio")
    public String getSessionTimeRatioChartPage(Model model) {
        return "api/session_time_ratio";
    }

    @GetMapping("/api/session_time_ratio/data")
    @ResponseBody
    public List<AdsSessionTimeRatio> getSessionTimeRatioData() {
        return adsSessionTimeRatioMapper.selectAll();
    }

}
